package com.topscomm.pub.util;

import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSON;

public class ObjectWithMapUtil {

    /**
     * @description: fastjson转换方法 Object转Map
     * @param obj
     * @return java.util.Map<java.lang.String,java.lang.Object>
     * @author: wangxinhua
     * @date: 2020/12/3 10:01
     * @modify:
     */
    public static Map<String,Object> ObjectToMap(Object obj){
        return JSONObject.parseObject(JSON.toJSONString(obj));
    }

    /**
     * @description: fastjson转换方法 Map转Object
     * @param map
     * @return java.util.Map<java.lang.String,java.lang.Object>
     * @author: wangxinhua
     * @date: 2020/12/3 10:01
     * @modify:
     */
    public static Object MapToObject(Map<String,Object> map){
        return JSONObject.parseObject(JSON.toJSONString(map), Object.class);
    }
}
